Archive Data from ClickhouseΒΆ

Why do we need to archive?

To keep the database size of Motadata in check, we recommend periodic archival of data. Archiving the data prevents any unforeseen error that may appear due to low disk size, hard disk performance etc. Archiving the data is a standard approach to comply with government regulations of storing the database for some years. Motadata allows you to archive the database from backend. For this you should have access to backend and admin level rights. Following are the steps for safe and secure archive.

Take Database Backup

  1. Go to the location where backup.sh and restore.sh are present.

  2. Give 777 permissions to both the scripts.

  3. Remove the content of shadow folder of clickhouse directory.

  4. Run backup script to take the backup at your preferred location

cd <Location of backup.sh and restore.sh files>
chmod 777 backup.sh restore.sh
rm -r /motadata/clickhouse/shadow/*
sh backup.sh <backup directory>             //do not add slash (/) after directory name

Restore Database

Use the following steps to restore the database:

  1. Go to the location where backup.sh and restore.sh are present.

  2. Run restore script and provide location where backup is present

cd <Location of backup.sh and restore.sh files>
sh restore.sh <backup directory>             //do not add slash (/) after directory name